import yagmail
data={
    'user':'2286726308@qq.com',
    'password':'ejnmncadmpfueajg',
    'host':'smtp.qq.com'


}

try:
    yag = yagmail.SMTP(user=data['user'],password=data['password'],host=data['host'],encoding='GBK')
    contents="测试财务"
    attachment = r"D:\Users\Administrator\PycharmProjects\pythonProject2\财务系统测试报告.html"

    yag.send(to='13552648187@163.com',subject='测试报告',contents=contents,attachments= attachment)
    yag.close()
    print("成功")
except:
    print("erro")
